package com.sc.nft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.UserSignIn;
import com.sc.nft.entity.vo.DailyParticipationStatisticsVO;
import com.sc.nft.entity.vo.LotteryDataPageVO;
import com.sc.nft.entity.vo.ParticipationDateDataVO;
import lombok.Data;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
* @author 张超
* @description 针对表【sc_user_sign_in(用户签到表)】的数据库操作Mapper
* @createDate 2024-06-04 13:29:51
* @Entity generator.domain.UserSignIn
*/
@Mapper
public interface UserSignInMapper extends BaseMapper<UserSignIn> {


    /**
     * 根据活动Id签到活动的参与人数
     * @param activityBasicsId
     * @return
     */
    Long getAttendUserCount(@Param("activityBasicsId") Long activityBasicsId);

    /**
     * 根据活动Id获取签到活动的参与次数
     * @param activityBasicsId
     * @return
     */
    Long getAttendCount(@Param("activityBasicsId") Long activityBasicsId);

    /**
     * 签到活动获取日参与统计数据
     * @param activityBasicsId
     * @param startTime
     * @return
     */
    List<DailyParticipationStatisticsVO> getDayStatisticalData(@Param("activityBasicsId") Long activityBasicsId, @Param("startTime")Date startTime);

    /**
     * 获取签到活动详情列表信息
     * @param activityBasicsId
     * @param page
     * @param userTel
     * @return
     */
    IPage<LotteryDataPageVO> getlotteryDataPage(@Param("activityBasicsId") Long activityBasicsId, Page page,@Param("userTel")String userTel);

    /**
     * 从补签记录中查询用户补签了多少次
     * @param userId
     * @param activityBasicsId
     * @return
     */
    Integer getSupplementarySignatureCount(Long userId, Long activityBasicsId);

    /**
     * 查询用户是否签到
     * @param userId
     * @param activityBasicsId
     * @return
     */
    int getIsSignInByUserId(@Param("userId") Long userId,@Param("activityBasicsId")Long activityBasicsId);

    /**
     * 根据活动Id获取签到来源为0的用户签到记录
     * @param activityBasicsId
     * @return
     */
    List<UserSignIn> getSignInTimeByActivityBasicsId(@Param("activityBasicsId") Long activityBasicsId);

    /**
     * 根据活动Id和用户Id获取用户正常签到记录
     * @param activityBasicsId
     * @param userId
     * @return
     */
    List<UserSignIn> getSignInTimeByActivityBasicsIdAndUserId(@Param("activityBasicsId") Long activityBasicsId,@Param("userId") Long userId);
}




